// import com.alibaba.druid.DbType;
// import com.alibaba.druid.sql.SQLUtils;
// import com.alibaba.druid.sql.ast.SQLExpr;
// import com.alibaba.druid.sql.ast.SQLStatementImpl;
// import com.alibaba.druid.sql.dialect.oracle.visitor.OracleASTVisitor;
// import com.alibaba.druid.sql.visitor.SQLASTVisitor;

#include "OracleRunStatement.h"
#include "../../../../../DbType.h"
#include "../../../../SQLUtils.h"
#include "../../../../ast/SQLExpr.h"
#include "../../visitor/OracleASTVisitor.h"
#include "../../../../visitor/SQLASTVisitor.h"

OracleRunStatement::OracleRunStatement()
    : SQLStatementImpl(DbType_ptr(new DbType(&DbType::oracle)))
{
}

OracleRunStatement::OracleRunStatement(SQLExpr_ptr expr)
    : SQLStatementImpl(DbType_ptr(new DbType(&DbType::oracle)))
{

  this->setExpr(expr);
}

// @Override
void OracleRunStatement::accept0(OracleASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(OracleRunStatement)))
  {
    acceptChild(visitor, expr);
  }
  visitor->endVisit(SharedObject(OracleRunStatement));
}

void OracleRunStatement::accept0(SQLASTVisitor_ptr visitor)
{
  accept0(std::dynamic_pointer_cast<OracleASTVisitor>(visitor));
}

string_ptr OracleRunStatement::toString()
{
  return SQLUtils::toOracleString(SharedObject(OracleRunStatement));
}

SQLExpr_ptr OracleRunStatement::getExpr()
{
  return expr;
}

void OracleRunStatement::setExpr(SQLExpr_ptr expr)
{
  if (expr != nullptr)
  {
    expr->setParent(SharedObject(OracleRunStatement));
  }
  this->expr = expr;
}
